﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mathematics
{
    public static class SystemFunctions
    {
        #region Math Formulas

        #region Trigonometric Functions

        public static double tanr(params double[] parameters)
        {
            return Math.Tan(parameters[0]);
        }

        public static double tand(params double[] parameters)
        {
            return Math.Tan(rad(parameters[0]));
        }

        public static double cosr(params double[] parameters)
        {
            return Math.Cos(parameters[0]);
        }

        public static double cosd(params double[] parameters)
        {
            return Math.Cos(rad(parameters[0]));
        }

        public static double sinr(params double[] parameters)
        {
            return Math.Sin(parameters[0]);
        }

        public static double sind(params double[] parameters)
        {
            return Math.Sin(rad(parameters[0]));
        }

        public static double rad(params double[] parameters)
        {
            return Math.PI * parameters[0] / 180.0;
        }

        public static double deg(params double[] parameters)
        {
            return parameters[0] * (180.0 / Math.PI);
        }

        #endregion

        #endregion

        #region System Function Definitions

        public static readonly FunctionDefinition Sinr = new SystemFunctionDefinition("sinr",sinr, new ParameterDefinition("x"));
        public static readonly FunctionDefinition Sin = new SystemFunctionDefinition("sin", sind, new ParameterDefinition("x"));
        public static readonly FunctionDefinition Cosr = new SystemFunctionDefinition("cosr", cosr, new ParameterDefinition("x"));
        public static readonly FunctionDefinition Cos = new SystemFunctionDefinition("cos", cosd, new ParameterDefinition("x"));
        public static readonly FunctionDefinition Tanr = new SystemFunctionDefinition("tanr", tanr, new ParameterDefinition("x"));
        public static readonly FunctionDefinition Tan = new SystemFunctionDefinition("tan", tand, new ParameterDefinition("x"));
        public static readonly FunctionDefinition Rad = new SystemFunctionDefinition("rad", rad, new ParameterDefinition("x"));
        public static readonly FunctionDefinition Deg = new SystemFunctionDefinition("deg", deg, new ParameterDefinition("x"));

        #endregion 
    }
}
